import request from "@/service/request";
import { GetSwiperList } from "./types";
// 获取轮播图列表
const getSwiperList = (query: GetSwiperList) => {
  return request({
    url: "/course/carousel/list",
    method: "get",
    params: query,
  });
};

/**
 * 获取学校新闻列表
 * @param query
 */
const getNewsList = (query: any) => {
  return request({
    url: "/school/article/list",
    method: "get",
    params: query,
  });
};

// 新增轮播图
const addSwiper = (query: any) => {
  return request({
    url: "/course/carousel",
    method: "post",
    data: query,
  });
};

// 更新轮播图
const updateSwiper = (query: any) => {
  return request({
    url: "/course/carousel/edit",
    method: "put",
    data: query,
  });
};

// 删除轮播图
const deleteSwiper = (id: string | string[]) => {
  return request({
    url: `/course/carousel/${id}`,
    method: "delete",
  });
};
export { getSwiperList, getNewsList, addSwiper, updateSwiper, deleteSwiper };
